package com.zhaohui.dao;

import com.zhaohui.entity.User;
import com.zhaohui.util.C3P0Until;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class UserDao {
    private QueryRunner runner = new QueryRunner(C3P0Until.getDataSource());

    public List<User> findAll() throws SQLException {
        String sql = "select u_id id,u_name name,u_acc acc,u_pass pass from t_user";
       return runner.query(sql,new BeanListHandler<>(User.class));
    }
}
